0'THIS PROGRAM USES THE COLOR GRAPHICS ADAPTOR.                                    ACTIVATE LINE 410 IF YOU WANT TO USE THE                                        MONOCHROME ADAPTOR AS WELL.
1 REM HANGMAN PROGRAM
2 REM WRITTEN BY BARRY SHIFFRIN  3/13/82
3 PLAY "mb"
10 DEF FNTM(X$)=VAL(RIGHT$(X$,2))+(60*VAL(MID$(X$,4,2)))+(120*VAL(LEFT$(X$,2)))
20 READ NUMW
30 DIM WA$(NUMW)
40 FOR I=0 TO NUMW-1:READ WA$(I):NEXT I
50 SEED=FNTM(TIME$)
60 RANDOMIZE SEED
70 PW$=WA$(RND*(NUMW-1))
80 GOSUB 340:KEY OFF
90 GOSUB 410:GOSUB 340:COLOR 8,0
100 CLS:DEF SEG=0:FAILS=0:R=0:G$=""
110 IF INKEY$<>"" THEN POKE 106,0:GOTO 110
120 G$=SPACE$(LEN(PW$))
130 LOCATE 3,15:FOR I=1 TO LEN(PW$):PRINT USING "& ";"_";:NEXT I
140 ALU$="ABCDEFGHIJKLMNOPQRSTUVWXYZ":ALL$="abcdefghijklmnopqrstuvwxyz"
150 LOCATE 22,1:FOR I=1 TO 13:PRINT USING"&  ";MID$(ALU$,I,1);:NEXT I
160 LOCATE 24,1:FOR I=14 TO 26:PRINT USING"&  ";MID$(ALU$,I,1);:NEXT I
170 A$=INKEY$:IF A$="" THEN GOTO 170
175 IF ASC(A$)>=97 THEN A$=CHR$(ASC(A$)-32)
180 FLAG=0
190 FOR I=1 TO LEN(PW$)
200 IF A$=MID$(PW$,I,1) THEN LOCATE 3,13+2*I:PRINT USING "&";A$;:FLAG=1:MID$(G$,I,1)=A$
210 NEXT I
220 IF G$=PW$ THEN LOCATE 10,1:PRINT "YOU WIN";:GOSUB 1000:GOSUB 410:GOTO 290
230 PS=INSTR(ALU$+ALL$,A$)
240 IF PS>26 THEN PS=PS-26
250 IF PS<>0 AND PS<=13 THEN LOCATE 22,1+(PS-1)*3:PRINT USING"&";" ";
260 IF PS<>0 AND PS>13 THEN LOCATE 24,1+(PS-14)*3:PRINT USING"&";" ";
270 IF FLAG=0 THEN FAILS=FAILS+1:ON FAILS GOSUB 490,530,560,590,620,660,700,730,760,790,820,850
280 IF FAILS=12 THEN LOCATE 10,1:GOSUB 2000:PRINT "SORRY - YOU LOSE";:LOCATE 11,1:PRINT "THE WORD WAS";:LOCATE 12,1:PRINT PW$;:GOSUB 410:GOTO 290 ELSE GOTO 170
290 IF INKEY$<>"" THEN POKE 106,0:GOTO 290
300 PRINT "PRESS THE X KEY TO END THE GAME"
310 PRINT "ANY OTHER KEY WILL CONTINUE WITH ANOTHER GAME"
320 ANS$=INKEY$:IF ANS$="" THEN GOTO 320
330 IF ANS$="X" OR ANS$="x" THEN GOTO 65140: ELSE GOTO 70
340 REM switch to color/graphics adapter
350 DEF SEG=0
360 POKE &H410,(PEEK(&H410) AND &HCF) OR &H20
370 DEF SEG
380 LOCATE ,,1,6,7
381 SCREEN 1,0:COLOR 8,0
390 SCREEN 1,0
400 RETURN
410 RETURN'REM SWITCH TO MONOCHROME ADAPTER
420 DEF SEG=0
430 POKE &H410,(PEEK(&H410) OR &H30)
440 DEF SEG
450 LOCATE ,,1,12,13
460 SCREEN 0
470 WIDTH 80
480 RETURN
490 REM SUBROUTINE TO DRAW GALLOWS
500 DRAW "C2BM100,150U10R100D10"
510 DRAW "BU10BL90U100R46D10"
520 RETURN
530 REM SUBROUTINE TO DRAW HEAD
540 CIRCLE (156,59),9,2
550 RETURN
560 REM SUBROUTINE TO DRAW NECK
570 DRAW "C2BM156,67D6"
580 RETURN
590 REM SUBROUTINE TO DRAW BODY
600 DRAW "C2BM148,74R16D20L16U20"
610 RETURN
620 REM SUBROUTINE TO DRAW ARM ON LEFT
630 DRAW "C2BM148,74G14"
640 CIRCLE (132,90),2,2
650 RETURN
660 REM SUBROUTINE TO DRAW ARM ON RIGHT
670 DRAW "C2BM164,74F14"
680 CIRCLE (178,90),2,2
690 RETURN
700 REM SUBROUTINE TO DRAW LEG ON LEFT
710 DRAW "C2BM150,95D20L6U2R6"
720 RETURN
730 REM SUBROUTINE TO DRAW LEG ON RIGHT
740 DRAW "C2BM162,95D20R6U2L6"
750 RETURN
760 REM SUBROUTINE TO DRAW EYE ON LEFT
770 PSET (154,57),2
780 RETURN
790 REM SUBROUTINE TO DRAW EYE ON RIGHT
800 PSET (158,57),2
810 RETURN
820 REM SUBROUTINE TO DRAW NOSE
830 PSET (156,60),2
840 RETURN
850 REM SUBROUTINE TO DRAW MOUTH
860 DRAW "BM153,63R6"
870 RETURN
1000 REM subroutine to play winning music
1010 PLAY "t230o3ao4cege6g"
1020 RETURN
2000 REM subroutine to play losing music
2010 PLAY "t170o1g.g.g8g.a#.a8a.g8g.g-8g"
2020 RETURN
5000 DATA 93                     :REM THIS IS THE NUMBER OF WORDS FOLLOWING
5010 DATA CAT,DOG,MAN,HOUSE,CAR  :REM YOU MAY HAVE AS MANY WORDS AS YOU WISH
5020 DATA HOUSE,MOUSE,PIG,ANDREA,ERICA,BARRY,RONDA       :REM BE SURE TO USE
5030 DATA IBM,HILLEL,HELLO,GOOD,FRIEND,ELEPHANT,COW      :REM ALL CAPITALS FOR
5040 DATA PENCIL,PEN,CRAYON,MARKER                       :REM THESE WORDS HERE
5050 DATA CLOCK,FAN,CAKE,PIE,MARCH,APRIL,MONDAY,TUESDAY  :REM THE PROGRAM WILL
5060 DATA WEDNESDAY,STOP,THURSDAY,FRIDAY,OUT,SATURDAY,OFF :REM ACCEPT LOWER CASE
5070 DATA JANUARY,FEBRUARY,MAY,JUNE,JULY,AUGUST,HELP,SEPTEMBER   :REM OR UPPER
5080 DATA OCTOBER,DOOR,DECEMBER,PHONE,COMPUTER,TEMPLE,SCHOOL     :REM FOR YOUR
5090 DATA BOOK,CARD,LIBRARY,SISTER,MOTHER,FATHER,BROTHER         :REM GUESSES
5100 DATA GAME,RED,BLUE,GREEN,YELLOW
5110 DATA LISTEN,PLAY,LOOK,LEARN,TOOK,BOOK,BIKE,AARDVARK
5120 DATA BECAUSE,CAUSE,GIRAFFE,MONKEY,LION,TIGER,LEOPARD
5130 DATA DATE,TODAY,STREET,ACORN,DRIVE,WORCESTER,NEWHAVEN
5140 DATA NEWYORK,MASSACHUSETTS,KNOB,COOKY,SQUARE,TRIANGLE
65140 RUN"BASMENU
